<?php
/**
 * A really simple router to load a controller for the new admin modules
 * in .htaccess, /admin/_name_ becomes => /admin/router.php?module=_name_&(other-query-parameters)
 *
 * @author Wavetrex (wavetrex@gmail.com)
 * @package CargoClaims
 * @version 1.0.dev
 */
class MVC_Router
{
	/**
	 * The Launcher
	 */
	public static function launch()
	{
		define('DS', DIRECTORY_SEPARATOR);
		define('ROOT', dirname(dirname(__FILE__)));

		include_once(ROOT. DS. 'lib'. DS. 'mvc'. DS. 'core.php');
		include_once(ROOT. DS. 'lib'. DS. 'helpers.php');

		MVC_Core::init();
		$rget = new MVC_Request('get');

		// run the controller by dispatching the GET.action variable to it's "Action Methods"
		$controller = MVC_Core::factory_Controller(isset($rget-> module)? $rget-> module : 'index');
		$controller->_dispatch($rget-> action);
	}
}

MVC_Router::launch();